<?php
session_start();
include_once( 'config.php' );
include_once( 'weibooauth.php' );

$c = new WeiboClient( WB_AKEY , WB_SKEY , $_SESSION['last_key']['oauth_token'] , $_SESSION['last_key']['oauth_token_secret']  );
$ms  = $c->home_timeline(); // done
$me = $c->verify_credentials();

//Statuses/followers
//返回用户关注对象列表，并返回最新微博文章。
$c = new WeiboClient( WB_AKEY , 
                      WB_SKEY , 
                      $_SESSION['last_key']['oauth_token'] , 
                      $_SESSION['last_key']['oauth_token_secret']  );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xn="http://www.renren.com/2009/xnml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>YouYan</title>
<meta name="keywords" content="YouYan" />
<meta name="author" content="YouYan" />
<meta name="description" content="YouYan SNS Talk Service" />
<link href="css/global.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="jquery.ui/jquery-1.4.2.min.js"></script>
<script language="javascript" src="js/global.js"></script>
</head>
<body>
<form>
<input type="text" name="inputMicroBlog" id="inputMicroBlog" style="width:300px" />
<input type="button" value="submit" onclick="sendMB();" />
</form>

<?php
if(isset($_REQUEST['inputMicroBlog'])){
	$rr = $c->update( $_REQUEST['inputMicroBlog'] );
	echo "<p>done</p>";
}
?>
<div id='appendBox'></div>
<?php if( is_array( $ms ) ): ?>
<?php foreach( $ms as $item ): ?>
<div style="padding:10px;margin:5px;border:1px solid #ccc">
<?=$item['text'];?>
</div>
<?php endforeach; ?>
<?php endif; ?>

</body>
</html>
